﻿using BJ.AuthEntity.Models;
using Mapster;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BJ.AuthEntity.ViewModels
{
    /// <summary>
    /// 类型映射
    /// </summary>
    public class Mapper : IRegister
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="config"></param>
        public void Register(TypeAdapterConfig config)
        {
            config.ForType<AdminUser, VM_User>()
                .Map(src => src.Account, dto => dto.Auth.Account)
                .Map(src => src.UserName, dto => dto.Name)
                .Map(src => src.Id, dto => dto.Id)
                .Map(src => src.RoleName, dto => dto.Role.Name)
                .Map(src => src.Emil, dto => dto.Emil)
                .Map(src => src.Phone, dto => dto.Phone);

            config.ForType<User, VM_User>()
                .Map(src => src.Account, dto => dto.Auth.Account)
                .Map(src => src.UserName, dto => dto.Name)
                .Map(src => src.Id, dto => dto.Id)
                .Map(src => src.Emil, dto => dto.Emil)
                .Map(src => src.Phone, dto => dto.Phone);

            //
        }
    }
}
